package com.itheima.day04;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.MonthDay;

public class Demo6 {
    public static void main(String[] args) {
        LocalDate now = LocalDate.now();

        System.out.println("now = " + now);
        int year = now.getYear();
        System.out.println("year = " + year);
        int monthValue = now.getMonthValue();
        Month month = now.getMonth();
        System.out.println("month = " + month);
        System.out.println("month = " + monthValue);
        int dayOfMonth = now.getDayOfMonth();
        System.out.println("dayOfMonth = " + dayOfMonth);
        System.out.println("========");
        LocalDate localDate = LocalDate.of(2024, 2, 8);
        System.out.println("localDate = " + localDate);
        System.out.println("=======");
        System.out.println(now.plusYears(1));
        System.out.println(now.plusMonths(1));
        System.out.println(now.plusDays(1));
        System.out.println("======");
        System.out.println(now.minusYears(1));
        System.out.println("=======");
        System.out.println("now.equals(localDate) = " + now.equals(localDate));
        MonthDay nowMonthDay = MonthDay.now();
        MonthDay birthday = MonthDay.from(localDate);
        System.out.println(nowMonthDay.equals(birthday));
        System.out.println(birthday.isBefore(nowMonthDay));
        System.out.println("======");
        System.out.println(birthday);
        System.out.println(birthday.withMonth(12));
    }
}
